package clueless.utilities;

import static org.junit.Assert.*;

import org.junit.Test;

public class MapTest {
	
	@Test
	public void testBillardRoom() {
		Map map = new Map();
		
		Room billardRoom = map.getBillardRoom();
		
		assertNotNull(billardRoom.getLeftRoom());
		assertNotNull(billardRoom.getUpRoom());
		assertNotNull(billardRoom.getRightRoom());
		assertNotNull(billardRoom.getDownRoom());
		
		assertEquals(billardRoom.getLeftRoom().getLeftRoom(), map.getLibrary());
		assertEquals(billardRoom.getUpRoom().getUpRoom(), map.getHall());
		assertEquals(billardRoom.getRightRoom().getRightRoom(), map.getDiningRoom());
		assertEquals(billardRoom.getDownRoom().getDownRoom(), map.getBallroom());
	}
	
	@Test
	public void testKitchen() {
		Map map = new Map();
		
		Room kitchen = map.getKitchen();
		
		assertNull(kitchen.getDownRoom());
		assertNull(kitchen.getRightRoom());
		
		assertNotNull(kitchen.getLeftRoom());
		assertNotNull(kitchen.getUpRoom());
		
		
		
		assertEquals(kitchen.getLeftRoom().getLeftRoom(), map.getBallroom());
		assertEquals(kitchen.getUpRoom().getUpRoom(), map.getDiningRoom());
		
		assertEquals(kitchen.getSecretRoom(), map.getStudy());
	}
	
	@Test
	public void testBallroom() {
		Map map = new Map();
		
		Room ballroom = map.getBallroom();
		
		assertNull(ballroom.getDownRoom());
		
		assertNotNull(ballroom.getLeftRoom());
		assertNotNull(ballroom.getUpRoom());
		assertNotNull(ballroom.getRightRoom());
		
		
		assertEquals(ballroom.getLeftRoom().getLeftRoom(), map.getConservatory());
		assertEquals(ballroom.getUpRoom().getUpRoom(), map.getBillardRoom());
		assertEquals(ballroom.getRightRoom().getRightRoom(), map.getKitchen());
	}
	
	@Test
	public void testConservatory() {
		Map map = new Map();
		
		Room conservatory = map.getConservatory();
		
		assertNull(conservatory.getLeftRoom());
		assertNull(conservatory.getDownRoom());
		
		assertNotNull(conservatory.getUpRoom());
		assertNotNull(conservatory.getRightRoom());
		
		
		assertEquals(conservatory.getUpRoom().getUpRoom(), map.getLibrary());
		assertEquals(conservatory.getRightRoom().getRightRoom(), map.getBallroom());
		
		assertEquals(conservatory.getSecretRoom(), map.getLounge());
	}
	
	@Test
	public void testDiningRoom() {
		Map map = new Map();
		
		Room diningRoom = map.getDiningRoom();
		
		assertNull(diningRoom.getRightRoom());
		
		assertNotNull(diningRoom.getLeftRoom());
		assertNotNull(diningRoom.getUpRoom());
		assertNotNull(diningRoom.getDownRoom());
		
		assertEquals(diningRoom.getLeftRoom().getLeftRoom(), map.getBillardRoom());
		assertEquals(diningRoom.getUpRoom().getUpRoom(), map.getLounge());
		assertEquals(diningRoom.getDownRoom().getDownRoom(), map.getKitchen());
	}
	@Test
	public void testLibrary() {
		Map map = new Map();
		
		Room library = map.getLibrary();
		
		assertNull(library.getLeftRoom());
		
		assertNotNull(library.getUpRoom());
		assertNotNull(library.getRightRoom());
		assertNotNull(library.getDownRoom());
		
		assertEquals(library.getUpRoom().getUpRoom(), map.getStudy());
		assertEquals(library.getRightRoom().getRightRoom(), map.getBillardRoom());
		assertEquals(library.getDownRoom().getDownRoom(), map.getConservatory());
	}
	
	@Test
	public void testLounge() {
		Map map = new Map();
		
		Room lounge = map.getLounge();
		assertNull(lounge.getUpRoom());		
		assertNull(lounge.getRightRoom());
		
		assertNotNull(lounge.getLeftRoom());
		assertNotNull(lounge.getDownRoom());
		
		assertEquals(lounge.getLeftRoom().getLeftRoom(), map.getHall());
		assertEquals(lounge.getDownRoom().getDownRoom(), map.getDiningRoom());
		assertEquals(lounge.getSecretRoom(),map.getConservatory());
	}
	
	@Test
	public void testStudy() {
		Map map = new Map();
		
		Room study = map.getStudy();
		assertNull(study.getUpRoom());
		assertNull(study.getLeftRoom());
		
		assertNotNull(study.getRightRoom());
		assertNotNull(study.getDownRoom());
		
		assertEquals(study.getRightRoom().getRightRoom(), map.getHall());
		assertEquals(study.getDownRoom().getDownRoom(), map.getLibrary());
		assertEquals(study.getSecretRoom(),map.getKitchen());
	}
	
	@Test
	public void testHall() {
		Map map = new Map();
		
		Room hall = map.getHall();
		assertNull(hall.getUpRoom());
		
		assertNotNull(hall.getDownRoom());
		assertNotNull(hall.getLeftRoom());
		assertNotNull(hall.getRightRoom());
		
		assertEquals(hall.getDownRoom().getDownRoom(), map.getBillardRoom());
		assertEquals(hall.getLeftRoom().getLeftRoom(), map.getStudy());
		assertEquals(hall.getRightRoom().getRightRoom(), map.getLounge());
	}

}
